<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div id="app">
			<!-- 数组相关的用法 队列/栈  push 压栈  pop 弹栈
					push()在最后追加元素
					pop() 从最后删除元素
					shift() 从开头删除元素
					unshift() 从开头追加元素
					splice() 替换数据
					sort() 排序按照字符串编码顺序排列
					reverse() 数组反转-->
			<span v-for="itme in array">{{itme}},</span><br>
			追加数据：<input type="text" v-model.number="num" /> -->
			
			<button @click="push">push</button>
			<button @click="pop">pop</button>
			<button @click="shift">shift</button>
			<button @click="splice">替换</button> 
		</div>
		<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
		<script>
			const app =new Vue({
				el: "#app",
				data: {
					array: [1,2,3,4,5,6],
					num: ''
				},
				methods: {
					push(){
						this.array.push(this.num)
					},
					pop(){
						this.array.pop()
					},
					shift(){
						this.array.shift()
					},
					splice(){
						/**arg1:操作数据的起始位置，下标从0开始
						   arg2:*/
						this.array.splice(0,1,this.num)
						}
				}
			})
		</script>
	</body>
</html>
